<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <%@ include file="/common/CimsCommon.jsp" %>
   <title>新增T_C_MM_QUOTA</title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <link rel="stylesheet" href="<%=basePath%>/css/cims/cmmBase.css">
</head>
  
<body style="background-color:#FFFFFF">
<div id="formPageSwap">
  <br/>
<form id="addNewsFormData" name="addNewsFormData" isCheck="true" action="com.jy.modules.common.tcmmquota.controller.TCMmQuotaController">
	<div class="expandSwap">
		<div class="ui-widget-header ui-corner-all">
			<span class="text">额度申请</span>
			<span id="importContract" class="aColor" style="float:right;margin-bottom:10px;text-decoration:underline;cursor:pointer;" onclick=""><b>导入合约</b></span>
		</div>
		<div class="expandContent">
			<!-- <input type="button" id="importContract" value="导入合约" style="margin-bottom:10px;" onclick=""/> -->
			
			<%@include file="/common/cims/tCMmQuotaContent.jsp" %>
			<fieldset style="padding:10px;margin:10px;">
				<legend>债权约束</legend>
				<div id="constraintContainer">
					<%@include file="contractConstraint.jsp" %>
				</div>
			</fieldset>
		</div>
		<div class="expandToolbar">
			<span class="submitBtn" onclick="doAddFrom();">提交</span>
			<span class="submitBtn" onclick="parent.tabs.close();">关闭</span>
		</div>
	</div>
<!-- 保存 关闭 按钮 在 查询页面进行控制 -->  
</form>

</div>
<script type="text/javascript" src="<app:contextPath/>/js/cims/limitRequest/queryTCMmQuota.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/cims/publicJs/importContract.js"></script>
</body>

<script type="text/javascript">
   $(document).ready(function(){
   		var quotaType="${quotaTypeDict.DICVALUE}";
   		checkedInit();//平台校验不兼容IE
   		Cmm.util.dateInputInit("addNewsFormData");
   		Cmm.util.checkDdateInit("dtostartDate","dtoinvalidDate");
   		
   		$("#dtostartDate").datepicker("option","minDate",new Date().format("yyyy-MM-dd"));
   		var crDate=$("#dtocreditReferDate");
   		$("#dtostartDate").on("change",function(){
	   		crDate.datepicker("option","minDate",this.value);
   		});
   		$("#dtoinvalidDate").on("change",function(){
	   		crDate.datepicker("option","maxDate",this.value);
   		});
   		var importBtn=$("#importContract");
   		importBtn.on("click",importContract(function(contractCode){
   			var url=contextRootPath+"/tCMmQuota/queryOneContractAll?contractCode="+contractCode;
   			jyAjax(url,null,function(msg){
				//保存成功后，执行查询页面查询方法
	        	var v_status = msg.status;
	        	if(v_status.indexOf('ok') >-1){
	        		var cdto=msg.data.cdto,
	        			cooperorgDTO=msg.data.cooperorgDTO,
	        			agreementDTO=msg.data.agreementDTO;
	        		$("input[name=contractCode]").val(cdto.contractCode);
	        		$("input[name=contractName]").val(cdto.contractName);
	        		$("input[name=cooperorgCode]").val(cdto.cooperorgCode);
	        		$("input[name=cooperorgName]").val(cooperorgDTO&&cooperorgDTO.cooperorgName);
	        		$("input[name=agreementCode]").val(cdto.agreementCode);
	        		$("input[name=agreementName]").val(agreementDTO&&agreementDTO.agreementName);
	        		rebuildConstraintsEl({"contractCode":contractCode},"constraintContainer",
	        		contextRootPath+"/tCMmQuota/getContractConstraintHtml?contractCode="+contractCode);
	        	}
			});
   		},{type:quotaType}));
   		importBtn.trigger("click");
	});
</script>
  
</html>
